<?php


/*
* Copyright (c) 2008-2016 vip.com, All Rights Reserved.
*
* Powered by com.vip.osp.osp-idlc-2.5.11.
*
*/

namespace com\vip\svip\osp\service;

class SvipUserRightsInfo {
	
	static $_TSPEC;
	public $busType = null;
	public $saveAmount = null;
	public $openFloorYears = null;
	public $rightsTakeCount = null;
	public $freeDeliveryCount = null;
	
	public function __construct($vals=null){
		
		if (!isset(self::$_TSPEC)){
			
			self::$_TSPEC = array(
			1 => array(
			'var' => 'busType'
			),
			2 => array(
			'var' => 'saveAmount'
			),
			3 => array(
			'var' => 'openFloorYears'
			),
			4 => array(
			'var' => 'rightsTakeCount'
			),
			5 => array(
			'var' => 'freeDeliveryCount'
			),
			
			);
			
		}
		
		if (is_array($vals)){
			
			
			if (isset($vals['busType'])){
				
				$this->busType = $vals['busType'];
			}
			
			
			if (isset($vals['saveAmount'])){
				
				$this->saveAmount = $vals['saveAmount'];
			}
			
			
			if (isset($vals['openFloorYears'])){
				
				$this->openFloorYears = $vals['openFloorYears'];
			}
			
			
			if (isset($vals['rightsTakeCount'])){
				
				$this->rightsTakeCount = $vals['rightsTakeCount'];
			}
			
			
			if (isset($vals['freeDeliveryCount'])){
				
				$this->freeDeliveryCount = $vals['freeDeliveryCount'];
			}
			
			
		}
		
	}
	
	
	public function getName(){
		
		return 'SvipUserRightsInfo';
	}
	
	public function read($input){
		
		$input->readStructBegin();
		while(true){
			
			$schemeField = $input->readFieldBegin();
			if ($schemeField == null) break;
			$needSkip = true;
			
			
			if ("busType" == $schemeField){
				
				$needSkip = false;
				$input->readI32($this->busType); 
				
			}
			
			
			
			
			if ("saveAmount" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->saveAmount);
				
			}
			
			
			
			
			if ("openFloorYears" == $schemeField){
				
				$needSkip = false;
				$input->readI32($this->openFloorYears); 
				
			}
			
			
			
			
			if ("rightsTakeCount" == $schemeField){
				
				$needSkip = false;
				$input->readI32($this->rightsTakeCount); 
				
			}
			
			
			
			
			if ("freeDeliveryCount" == $schemeField){
				
				$needSkip = false;
				$input->readI32($this->freeDeliveryCount); 
				
			}
			
			
			
			if($needSkip){
				
				\Osp\Protocol\ProtocolUtil::skip($input);
			}
			
			$input->readFieldEnd();
		}
		
		$input->readStructEnd();
		
		
		
	}
	
	public function write($output){
		
		$xfer = 0;
		$xfer += $output->writeStructBegin();
		
		if($this->busType !== null) {
			
			$xfer += $output->writeFieldBegin('busType');
			$xfer += $output->writeI32($this->busType);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->saveAmount !== null) {
			
			$xfer += $output->writeFieldBegin('saveAmount');
			$xfer += $output->writeString($this->saveAmount);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->openFloorYears !== null) {
			
			$xfer += $output->writeFieldBegin('openFloorYears');
			$xfer += $output->writeI32($this->openFloorYears);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->rightsTakeCount !== null) {
			
			$xfer += $output->writeFieldBegin('rightsTakeCount');
			$xfer += $output->writeI32($this->rightsTakeCount);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->freeDeliveryCount !== null) {
			
			$xfer += $output->writeFieldBegin('freeDeliveryCount');
			$xfer += $output->writeI32($this->freeDeliveryCount);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		$xfer += $output->writeFieldStop();
		$xfer += $output->writeStructEnd();
		return $xfer;
	}
	
}

?>